﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Configuration;
using System.IO;
using System.Reflection;

namespace DevAwesome.WebDataBridge.MVC {
    public class WebDataBridgeController : Controller {

        public JsonResult Data( string bridgeId, string endPoint ) {

            var result = WebDataBridge.Instance.GetEndPointData( bridgeId, endPoint );

            if( result == null )
                Response.StatusCode = 403;

            return Json( result, JsonRequestBehavior.AllowGet );

        }

        public JsonResult Refresh( string bridgeId, string endPoint ) {

            var result = WebDataBridge.Instance.GetEndPointData( bridgeId, endPoint, true );

            if( result == null )
                Response.StatusCode = 403;

            return Json( result, JsonRequestBehavior.AllowGet );
        }

    }

}
